<%template _header%>
<%namespace YouHP.Model.Group%>
<%namespace YouHP.Utility%>
<!--header end-->


<script type="text/javascript">

	function checkCheckBox(form,objtag,itemname)
	{
		if (typeof(objtag.checked) == "undefined")
		{
			objtag.checked = true;
		}
		for(var i = 0; i < form.elements.length; i++) 
		{
			var e = form.elements[i];
			if(e.name == itemname) 
			{
				e.checked = objtag.checked;
			}
		}
		objtag.checked = !objtag.checked;
	}
	
	function AdminSubmit(adminId,adminType)
	{
		$('AdminId').value = adminId;
		$('AdminType').value = adminType;
	}
	
</script>

<!--主体-->
<div class="layout-cols2">
<div class="col1">
		<div class="box">
			<div class="caption"><%template _memgroupmenu%>	</div>
			<div class="content">
	
				<div class="pannelbody">
					<div class="messagelist">
					<%if ErrorCount==0%>
					
						<%if IsPost%>
						
							<%template _msgbox%>
							
						<%else%>
							
							<%csharp%>if(ApplyList.Count > 0) { <%/csharp%>
							<p>等待审批的用户({ApplyList.Count}个)</p>
							<form action="" method="post" ID="applyform">
								<input type="hidden" name="formtype" value="1"></input>
							<input type="hidden" name="applytype" id="applytype" value="0"></input>
							<table width="100%" style="padding-right:5px;">
								<tbody><tr>
									<td width="60">选择</td>
									<td width="110">头像</td>
									<td width="120">用户名</td>
									<td width="60">申请时间</td>
									<td></td> 
								</tr></tbody>
							</table>
							<div class="memberlist">
							<table width="100%">
								<%csharp%> foreach(GroupUserInfo info in ApplyList) { <%/csharp%>
								<tbody>
							  <tr class="messagetable" onmouseover="this.className='messagetableon'" onmouseout="this.className='messagetable'">
							    <td width="60"><input name="applyid" id="applyid{info.UserId}" type="checkbox" value="{info.UserId}" style="margin-top:-1px;"/></td>
							    <td width="110"><img src="{info.UserAvatar}" width="48" height="48" id="usingavatarimg" alt="头像"/></td>
							    <td width="120">{info.UserName}</td>
							    <td width="60">{info.JoinTime.ToString("yyyy-MM-dd")}</td>
							    <td></td>
							  </tr>
							  </tbody>
								<%csharp%> } <%/csharp%>
							</table></div>	 
							</form><br />
							<div style="text-align:right; padding-right:10px;">
								<a href="#" onclick="checkCheckBox($('applyform'),this,'applyid')" class="selectall">全选</a>&nbsp;&nbsp;&nbsp;
								<a href="#" onclick="$('applytype').value=1; $('applyform').submit();"  class="selectall">批准</a>&nbsp;&nbsp;&nbsp;
								<a href="#" onclick="$('applytype').value=2; $('applyform').submit();"  class="selectall">忽略</a>
							</div>														
							<%csharp%>}<%/csharp%>
							<br />
	
							
							<p>管理员({AdminList.Count}个)</p>
							<form action="" method="post" ID="adminform">
								<input type="hidden" name="formtype" value="2"></input>
							<input type="hidden" name="admintype" id="admintype" value="0"></input>
							<table width="100%">
								<tbody><tr>
									<td width="20">选择</td>
									<td width="60">头像</td>
									<td width="50">用户名</td>
									<td width="100">加入时间</td>
									<td width="50">角色</td> 
									<td width="150">操作</td> 
								</tr></tbody>
								</table>
							<div class="memberlist"><table width="100%">
								<%csharp%> foreach(GroupUserInfo info in AdminList) { <%/csharp%>
								<tbody>
							  <tr class="messagetable" onmouseover="this.className='messagetableon'" onmouseout="this.className='messagetable'">
							  	<td width="20"><input name="adminid" id="adminid{info.UserId}" type="checkbox" value="{info.UserId}" style="margin-top:-1px;"/></td>
							    <td width="60"><img src="{info.UserAvatar}" width="48" height="48" id="usingavatarimg" alt="头像"/></td>
							    <td width="50">{info.UserName}</td>
							    <td width="100">{info.JoinTime.ToString("yyyy-MM-dd")}</td>
							    	<td width="50">{info.Role}</td> 
									<td width="150">
							<%csharp%>if(info.Role==Constants.RoleAdmin) {<%/csharp%>		
							<a href="#" onclick="$('admintype').value=1; $('adminform').submit();"  class="selectall-1">降为普通成员</a>
							<%csharp%>} else {<%/csharp%>
							<a href="#" onclick="$('membertype').value=1; $('memberform').submit();" class="selectall-1">升为管理员</a>
							<%csharp%> } <%/csharp%>
							<a href="#" onclick="$('admintype').value=2; $('adminform').submit();" class="selectall">删除</a>
								
									
									</td>
							</tr>
							</tbody>
								<%csharp%> } <%/csharp%>
								
							<%csharp%> foreach(GroupUserInfo info in MemberList) { <%/csharp%>
								<tbody>
							  <tr class="messagetable" onmouseover="this.className='messagetableon'" onmouseout="this.className='messagetable'">
							  	<td width="20"><input name="memberid" id="Checkbox1" type="checkbox" value="{info.UserId}" style="margin-top:-1px;"/></td>
							    <td width="60"><img src="{info.UserAvatar}" width="48" height="48" id="Img1" alt="头像"/></td>
							    <td width="50">{info.UserName}</td>
							    <td width="100">{info.JoinTime.ToString("yyyy-MM-dd")}</td>
							    <td width="50">{info.Role}</td>
							    <td width="150">
							<%csharp%>if(info.Role==Constants.RoleAdmin) {<%/csharp%>		
							<a href="#" onclick="$('admintype').value=1; $('adminform').submit();"  class="selectall-1">降为普通成员</a>
							<%csharp%>} else {<%/csharp%>
							<a href="#" onclick="$('membertype').value=1; $('memberform').submit();" class="selectall-1">升为管理员</a>
							<%csharp%> } <%/csharp%>
							<a href="#" onclick="$('admintype').value=2; $('adminform').submit();" class="selectall">删除</a>
								
									
									</td>
							    
							</tr>
							</tbody>
								<%csharp%> } <%/csharp%>
								
								
								
							</table>
							</div>		 
							<br />
							<div style="text-align:right; padding-right:10px;">
							<a href="#" onclick="checkCheckBox($('adminform'),this,'adminid')" class="selectall">全选</a>&nbsp;&nbsp;&nbsp;
							<a href="#" onclick="$('admintype').value=1; $('adminform').submit();"  class="selectall-1">降为普通成员</a>&nbsp;&nbsp;&nbsp;
							<a href="#" onclick="$('admintype').value=2; $('adminform').submit();" class="selectall">删除</a>
							</div>
							</form>
							
							<br />
						
							
              <p>成员({MemberList.Count}个)</p>
							<form action="" method="post" ID="memberform">
							<input type="hidden" name="formtype" value="3"></input>
							<input type="hidden" name="membertype" id="membertype" value="0"></input>
							<table width="100%">
								<tbody><tr>
									<td width="60">选择</td>
									<td width="110">头像</td>
									<td width="120">用户名</td>
									<td width="60">加入时间</td>
								
									<td></td> 
								</tr></tbody>
								</table>
								<div class="memberlist">
								<table width="100%">
								<%csharp%> foreach(GroupUserInfo info in MemberList) { <%/csharp%>
								<tbody>
							  <tr class="messagetable" onmouseover="this.className='messagetableon'" onmouseout="this.className='messagetable'">
							  	<td width="60"><input name="memberid" id="memberid{info.UserId}" type="checkbox" value="{info.UserId}" style="margin-top:-1px;"/></td>
							    <td width="110"><img src="{info.UserAvatar}" width="48" height="48" id="usingavatarimg" alt="头像"/></td>
							    <td width="120">{info.UserName}</td>
							    <td width="60">{info.JoinTime.ToString("yyyy-MM-dd")}</td>
							    <td></td>
							</tr>
							</tbody>
								<%csharp%> } <%/csharp%>
							</table></div>	 
							<br />
							<div style="text-align:right; padding-right:10px; margin-bottom:10px;">
							<a href="#" onclick="checkCheckBox($('memberform'),this,'memberid')" class="selectall">全选</a>&nbsp;&nbsp;&nbsp;
							<a href="#" onclick="$('membertype').value=1; $('memberform').submit();" class="selectall-1">升为管理员</a>&nbsp;&nbsp;&nbsp;
							<a href="#" onclick="$('membertype').value=2; $('memberform').submit();" class="selectall">删除</a>
							</div>
							</form>

							
						<%/if%>
						
						</div>
						
					<%else%>
						<%template _memerrmsgbox%>
					<%/if%>
					
			  </div>
			</div>
		</div>
	</div>
		<div class="col2">
	    
	    <%template _UserMenu%>
	
	    <%template _PatientMenu%>
	    <%template _GroupMenu%>
	    <%template _MessageMenu%>
	
	</div>
</div>
<!--主体-->
<%template _footer%>
